/*
 * Created on Mar 7, 2005
 */
package org.scohen.juploadr.prefs;

/**
 * <p>
 * A Control for viewing and editing a sub-set of config settings. Each
 * ConfigurationForm implementation is responsible for validating and persisting
 * any changes made. This generic interface is intended to simplify the addition
 * of new types of preferences, for example with plugins.
 * </p>
 * <p>
 * In addition to the methods in the interface, the contract of
 * ConfigurationForm includes two additional requirements:
 * </p>
 * <ul>
 * <li>All implementations must be sub-classes of
 * org.eclipse.swt.widgets.Control. (Typically they will satisfy this
 * requirement by extending org.eclipse.swt.widgets.Composite or
 * org.eclipse.swt.widgets.Canvas.)</li>
 * <li>All implementations must provide a one-argument constructor which takes
 * as its only argument a parent org.eclipse.swt.widgets.Composite, which it is
 * expected will be used only to pass through to the super-class constructor.</li>
 * </ul>
 * 
 * @author John
 */
public interface ConfigurationForm {

    /**
     * Save any changes made using the form. If the form internally tracks
     * whether changes have been made, this call may be a no-op.
     */
    void saveChanges();

    /**
     * Validate any changes made, returning an array of user-friendly error
     * messages if there is a problem. If validation passes, then returns null
     * or an empty array.
     * 
     * @return
     */
    Fault validateChanges();

    /**
     * Get a short name for the preferences this form class provides access to.
     * 
     * @return a short name for the preferences this form provides access to.
     */
    String getFormName();

    void setConfigurationDialog(ConfigurationDialog dialog);
    
    void accountChanged();
}
